package cn.drenal.capcap.entity;

import cn.drenal.capcap.entity.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tangzc.autotable.annotation.ColumnComment;
import com.tangzc.autotable.annotation.ColumnDefault;
import com.tangzc.autotable.annotation.ColumnNotNull;
import com.tangzc.mpe.annotation.InsertFillTime;
import com.tangzc.mpe.annotation.InsertUpdateFillTime;
import com.tangzc.mpe.autotable.annotation.*;
import com.tangzc.mpe.processer.annotation.AutoDefine;
import com.tangzc.mpe.processer.annotation.AutoMapper;
import com.tangzc.mpe.processer.annotation.AutoRepository;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;

/**
 * 系统用户表
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper
@Table(comment = "系统用户表")
public class SysAdmin extends BaseEntity {
    @ColumnComment("主键")
    @ColumnId(mode = IdType.AUTO)
    private Long id;

    @ColumnComment("用户名")
    @ColumnNotNull
    @UniqueIndex
    private String username;

    @ColumnComment("密码")
    @ColumnNotNull
    private String password;

    @ColumnComment("昵称")
    private String nickname;

    @ColumnComment("头像")
    private String avatar;

    @ColumnComment("邮箱")
    private String email;

    @ColumnComment("手机号")
    private String phone;

    @ColumnComment("状态：0-禁用，1-启用，2-待审核")
    @ColumnNotNull
    @ColumnDefault("1")
    private Integer status;

    @ColumnComment("角色：super-admin-超级管理员，admin-管理员")
    @ColumnNotNull
    @ColumnDefault("admin")
    private String role;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ColumnComment("最后登录时间")
    private LocalDateTime lastLoginTime;
}